
using System;
using NUnit.Framework;

namespace Universe.Threading.Test
{
    [TestFixture]
    public class RangeFor_TestInt64
    {

        [Test]
        public void TestBack()
        {
            CompareUtil.IsEquals(new Int64[] { 5, 4, 3, 2, 1 }, RangeFor<Int64>.Back(5, 1), "RangeFor<Int64>.Back(5, 1)");
            CompareUtil.IsEquals(new Int64[] { 1 }, RangeFor<Int64>.Back(1, 1), "RangeFor<Int64>.Back(1, 1)");
            CompareUtil.IsEquals(new Int64[] { }, RangeFor<Int64>.Back(1, 5), "RangeFor<Int64>.Back(1, 5)");
            CompareUtil.IsEquals(new Int64[] { Int64.MaxValue, }, RangeFor<Int64>.Back(Int64.MaxValue, Int64.MaxValue), "RangeFor<Int64>.Back(Int64.MaxValue, Int64.MaxValue)");
            CompareUtil.IsEquals(new Int64[] { Int64.MinValue, }, RangeFor<Int64>.Back(Int64.MinValue, Int64.MinValue), "RangeFor<Int64>.Back(Int64.MinValue, Int64.MinValue)");
        }

        [Test]
        public void TestCreate()
        {
            CompareUtil.IsEquals(new Int64[] { Int64.MinValue + 3, Int64.MinValue + 1 }, RangeFor<Int64>.Create(Int64.MinValue + 3, Int64.MinValue, -2), "RangeFor<Int64>.Create(Int64.MinValue + 3, Int64.MinValue, -2)");
            CompareUtil.IsEquals(new Int64[] { Int64.MaxValue - 3, Int64.MaxValue - 1 }, RangeFor<Int64>.Create(Int64.MaxValue - 3, Int64.MaxValue, 2), "RangeFor<Int64>.Create(Int64.MaxValue - 3, Int64.MaxValue, 2)");
            CompareUtil.IsEquals(new Int64[] { 1 }, RangeFor<Int64>.Create(1, 2, 3), "RangeFor<Int64>.Create(1, 2, 3)");
            CompareUtil.IsEquals(new Int64[] { }, RangeFor<Int64>.Create(Int64.MaxValue, Int64.MinValue, 1), "RangeFor<Int64>.Create(Int64.MaxValue, Int64.MinValue, 1)");
            CompareUtil.IsEquals(new Int64[] { }, RangeFor<Int64>.Create(Int64.MinValue, Int64.MaxValue, -1), "RangeFor<Int64>.Create(Int64.MinValue, Int64.MaxValue, -1)");
            CompareUtil.IsEquals(new Int64[] { Int64.MaxValue }, RangeFor<Int64>.Create(Int64.MaxValue, Int64.MaxValue, 1), "RangeFor<Int64>.Create(Int64.MaxValue, Int64.MaxValue, 1)");
            CompareUtil.IsEquals(new Int64[] { Int64.MinValue }, RangeFor<Int64>.Create(Int64.MinValue, Int64.MinValue, -1), "RangeFor<Int64>.Create(Int64.MinValue, Int64.MinValue, -1)");
        }

        [Test]
        public void TestForward()
        {
            CompareUtil.IsEquals(new Int64[] { 1 }, RangeFor<Int64>.Forward(1, 1), "RangeFor<Int64>.Forward(1, 1)");
            CompareUtil.IsEquals(new Int64[] { 1, 2, 3, 4, 5 }, RangeFor<Int64>.Forward(1, 5), "RangeFor<Int64>.Forward(1, 5)");
            CompareUtil.IsEquals(new Int64[] { }, RangeFor<Int64>.Forward(5, 1), "RangeFor<Int64>.Forward(5, 1)");
            CompareUtil.IsEquals(new Int64[] { Int64.MaxValue }, RangeFor<Int64>.Forward(Int64.MaxValue, Int64.MaxValue), "RangeFor<Int64>.Forward(Int64.MaxValue, Int64.MaxValue)");
            CompareUtil.IsEquals(new Int64[] { Int64.MinValue }, RangeFor<Int64>.Forward(Int64.MinValue, Int64.MinValue), "RangeFor<Int64>.Forward(Int64.MinValue, Int64.MinValue)");
        }

    }
}

